package com.mobile.collect.activitys;

import android.app.Activity;
import android.content.Intent;
import android.text.TextUtils;
import android.view.View;

import com.mobile.collect.R;
import com.mobile.collect.present.BasePresent;
import com.mobile.collect.view.DescDialog;
import com.mobile.collect.view.InputDialog;
import com.mobile.collect.view.MyEditText;

import butterknife.BindView;
import butterknife.OnClick;
import cn.droidlover.xdroidmvp.kit.NToast;
import cn.droidlover.xdroidmvp.mvp.XActivity;

/**
 * 类名: InputEditActivity
 * 作者: 李学伟
 * 日期: 2020年10月14日 18:37
 * 描述:
 */
public class AddDescActivity extends XActivity<BasePresent> {
    @BindView(R.id.qunxianEt)
    MyEditText qunxianEt;

    int type;

    @Override
    public void initView() {
        super.initView();
        titleTv.setText("附加描述");
        rightTv.setText("确定");
        rightTv.setVisibility(View.VISIBLE);
    }

    @Override
    public void onRightClick(View view) {
        super.onRightClick(view);
        String adddesc = qunxianEt.getValue();
        if (TextUtils.isEmpty(adddesc)) {
            NToast.showToast(this, "请输入附加描述", 1);
        } else {
           Intent dataIntent = new Intent();
           dataIntent.putExtra("adddesc",adddesc);
           setResult(Activity.RESULT_OK,dataIntent);
           finish();
        }
    }

    @Override
    public void getDataFromServer() {

    }

    @Override
    public int getContentViewId() {
        return R.layout.activity_adddesc;
    }

    @Override
    public void getIntentData() {
    }

    @Override
    public BasePresent newP() {
        return new BasePresent();
    }


    public static void lunch(Activity act,int requestCode) {
        Intent intent = new Intent(act, AddDescActivity.class);
        act.startActivityForResult(intent,requestCode);
    }

    @Override
    public boolean isNotWorkConnect() {
        return false;
    }

    private void showDescDialog() {
        DescDialog numberPop = new DescDialog(this, "附加描述", new InputDialog.InputCompleteListener() {

            @Override
            public void onInputComplete(String value) {
                qunxianEt.appendValue(value);
            }
        });
        numberPop.show();
    }


    @OnClick(R.id.descMoreIv)
    public void onViewClicked() {
        showDescDialog();
    }
}
